package com.zhonglz.util.pay.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
	
	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id= "2016101800717185";//沙箱测试
	
	// 商户私钥，您的PKCS8格式RSA2私钥
	public static String merchant_private_key="MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCV0UQvbMjpGXcjJvYB5mefU1kU9Dug3uU0kfChQdWIEbQRcSjhWSHH3v5NMLYt/PKQmYIjEZZ4Jtn5NlrYpVZEWKrzvA26yJKTEYWTWy+r+Zln9UJuAmtSfVP3+ujdrHw2srkJsSVaINLmKrDoSgzF94Zgr8RaMHCsS/MlrIeG8hzFVR9qh3eD1uXdx8deSx2rvOBuq4UJIkpSg2XId5JfOErlATM2W8IDpLlIxkrBCOvH/i85rQLPkermHBYoq0wbTQAJGDge3CoLB69w82W9Ls9za3+YCyYd3wUa60KbjSmRFjKAeYVZmt18u6aEgid92Bt6GIEBStacUUBIVN+5AgMBAAECggEAEkDyDtkxTX1lz6mila6t93KfSvdLAJnH0XTqnas4yiBmES35biN/Ayw/TcZenBHSuB2MBpvQ+oi5TCz8OqNCdIddJN9HyPdBLJwY61BT6Z86urjeRCsVSnKstW0jzEaEx+FUvEKSK34OVC7laRgEoGY9QDCKOvbl84g5cuCnjqBnFC74J5PUf7VjcsJ315EVmv5ZISc77wDnYkymfN+BxwRawVtiz4uPvRQTMmk/Wbk1mzfa6Ul/kjiQ0ZQrJJo+VpgQFN57fX1CukcXJpnBTNfvYWviIU2qe1Lqb2LYaHwB4WR29vDP8lkQzsSO1/eiI/wjqyNGt6IHVDMzU8AP5QKBgQDezWHgGEclfvpD8dWkqsMxtfLOtxmU9eFKAIdG0LZUYsSiZzOjpKlaUzTEYEeJGjhgRmBK8MTDqPpZmyc4JE3KToh3W1+BpNJWyS0MILdShuBtOAWYgdd80c53DDdZS5vYuwr7li0YNEkRGW/7TpIkpvZcB3Z14ySiljzLwgUngwKBgQCsI+9jqPE5w6e6cWH5V7aQTDmSAWzG/6Np0tVVxhgKQaIe3dm9ACHOCWDIja/ItK2/yFvPyzfrrNr9GzgrnCAdIuZ+93EUOK0BFgBsTuQjKKxQCuH1J7aR1FbnC+/GMiU9z8fw4gjARcOTIkQVP6ske5DOoqkqWOQ5h9/T3317EwKBgAQJ7RBG4GNJnffFVn4ZqlgoWDJvF0OgAWl6APnDpsp4z9+xxzncLkW45Gf65tERbJwyKmSxYJ+7XG5rZZaa8d4M9mRTf7O17Sotk2d44FnaoA7ayR8um11j4D5ANnCj8jtHiLduzXp22Cw7LdB8aCHJ9QVODVOtvmhEGO4IoldJAoGATKJS2JNFkOnBqgcADvk1lVfZ6V4pBw6XuWza/KyL10UQ35z0ame8pPUX2TD6qOeG0nJoLUHTS2BQvY14nDGNOmtnIe8WsGHq4yjgV1dnyR86VwgBQBrF9HYLmiB+RkXcvn/aCysVqkNkpgQDO1J05nD8LoHLvcaFE/ehdblxK3ECgYBTcbAE2RkC/+s6Z+z1IdwEfYdXYo0ieWPBgtjdt9Zwx1n9ZC/sLEgnkARJ++5978iAuIUGAvnKkRTDiLtYN3Cq6C/EeTrt9AZ69igrjIbdDk79Nir86LQvoQzYj3ObXVmDtM/Iqj6p7RHkaed8ecVsFVLOmdTCPx48G2tL+bunzg==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
	public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoCgQK/UZiJKw+qEjJvglBuetDvkaD6YHVLfhPFh6eSIxtDu87nWL3t29A2NomDUApNFPtnxYykHI1zDLJNSDFdog2pUOWYRxVOF51z4X5i55c7Jqc+VeibnqatuSwmS5t/N/pLzXHCVZZEHShyFDI9xKwfVAZp8qhobIS2RX3nKleY4Z2oCKQ6WlIElbRG6bHOqCGAQNltPWjup07zMS1HSovPAAUCzTRwMD1rn4ry5jW5FMBjuOs91kMnMt8hq7Nb9O8gsP/miZpPcZAksQ3M6Twob09cKoVbt8i8bcOzI2ithWRMQyxFBqdvt/4qgvmNOTCQinQGnGZMtuP4XcJwIDAQAB";
	
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	//public static String notify_url = "http://243h0u3086.wicp.vip/XWantSignWeb/admin/pay/alipayNotify";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	//public static String return_url = "http://243h0u3086.wicp.vip/XWantSignWeb/admin/pay/alipayReturn";

	// 签名方式 
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";//沙箱
	//public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";//正式
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

